import request from '@/utils/request';

/**
 * @description 用户登录
 * @param {string}  userAccount
 * @param {string}  password
 * @returns {string} token
 */

export function login(data) {
  return request.post('/hydrobim/sysUser/loginPwd', data);
}

/**
 * @description 用户退出登录
 * @returns {string}
 */

export function logout(data) {
  return request.post('/hydrobim/sysUser/logout', data);
}

/**
 * @description 获取验证码
 * @returns {number} code
 */
export function getPhoneCode(data) {
  return request.get(`/hydrobim/sysUser/sendCode/${data}`);
}

/**
 * @description 验证验证码
 * @param {string}  userAccount  手机号
 * @param {string}  code   验证码
 * @returns {string}
 */
export function getCodeTest(data) {
  return request.post('/hydrobim/sysUser/loginCode', data);
}
// 用户自己编辑自己个人信息
export function putUserInfo(data) {
  return request.put('/hydrobim/sysUser/editUser', data);
}

// 获取全部地址
export function readFile(fileUrl) {
  return request.get(`/hydrobim/upload/bindFileUrl?fileUrl=${fileUrl}`);
}

// 获取当前登录人信息
export function getUserInfo() {
  return request.get(`/hydrobim/sysUser/getCurrentUser`);
}
// 获取工程数据库列表
export function getDamInfoRecord(data) {
  return request.post('/hydrobim/damInfoRecord/pageList',data)
}
// 获取用户列表
export function getSysUser(data) {
  return request.post('/hydrobim/sysUser/pageList',data)
}

// 获取所有角色
export function getRole() {
  return request.get('/hydrobim/sysRole/getAllRole')
}
// 添加用户
export function addUser(data) {
  return request.post('/hydrobim/sysUser/addUser',data)
}

// 修改用户
export function editUser(data) {
  return request.put('/hydrobim/sysUser/updateUser',data)
}

// 禁用启用用户 
export function enableUser(id) {
  return request.put(`/hydrobim/sysUser/disableUser/${id}`)
}

// 查看申请记录或者审核记录详情 
export function getDamInfoRecordById(id) {
  return request.get(`/hydrobim/damInfoRecord/getDamInfoRecordById/${id}`)
}

// 审核列表 
export function checkDamInfo(data) {
  return request.put(`/hydrobim/damInfoRecord/checkDamInfoRecord`,data)
}

// 修改密码
export function updatePwd(data) {
  return request.put(`/hydrobim/sysUser/updatePwd`,data)
}

// 忘记密码
export function forgetPwd(data) {
  return request.put(`/hydrobim/sysUser/forgetPwd`,data)
}

// 注册
export function registerUser(data) {
  return request.post('/hydrobim/sysUser/registerUser',data)
}
